<template>
  <div class="container">
    <div class="pic-logo-block">
      <img class="pic-logo" src="../../assets/baidu/baidu-logo.png">
    </div>
    <div class="int-block">
      <span class="demIpu"></span>
      <el-input
          v-model="input2"
          placeholder=""
          @focus="valueFlag=true"
          @input="inputEvent"
          @blur="valueFlag=false"
          clearable
      >
        <template #append>百度一下</template>
      </el-input>
      <div class="error" v-if="input2" @click="clearText">X</div>
      <div class="more-info" v-if="valueFlag">
        <div v-if="emptyFlag" class="more-info-content"></div>
        <div v-else>
          <div class="more-info-content" v-for="(item,index) in seachData" :key="index">
            {{ item }}
          </div>
        </div>
        <div class="last-list" v-if="!emptyFlag">反馈</div>
      </div>
    </div>

  </div>

</template>

<script lang="js" setup>
import {ref} from "vue";

let input2 = ref('')
let valueFlag = ref(false)
let emptyFlag = ref(true)

let seachData = ref([
  '世界上飞得最高的鸟是哪种鸟',
  '世界上飞得最高的鸟类',
  '世界上飞的最高的鸟是什么鸟?',
  '世界上飞得最高的鸟是什么它的飞行高度可达...',
  '世界上飞得最高的鸟是什么鸟能飞多高',
  '世界上飞得最高的鸟有哪些',
  '世界上飞得最高的八种鸟',
  '世界上飞得最高的鸟排行',
  '世界上飞得最高的鸟类前十名',
  '世界上飞的最高的鸟是?'
])

//
const inputEvent = () => {
  emptyFlag.value = true
  if (input2.value == '世界上飞得最高的鸟是哪种?') {
    emptyFlag.value = false
  }
}

const clearText = () => {
  input2.value = ''
  emptyFlag.value = true
}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.container {
  display: flex;
  //justify-content: center;
  align-items: center;
  flex-direction: column;

  .pic-logo-block {
    height: 24vh;
    min-height: 185px;
    max-height: 310px;
    position: relative;
    z-index: 0;
    text-align: center;
    display: flex;
    align-items: end;

    .pic-logo {
      height: 129px;
    }
  }
}

.more-info {
  width: 560px;
  position: absolute;
  top: 41px;
  min-height: 300px;
  border: solid 2px #409eff;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 0 10px;
  box-sizing: border-box;

  .more-info-content {
    color: #8c8e90;
    cursor: pointer;
    line-height: 30px;
    font-size: 14px;

    &:nth-child(1) {
      border-top: 1px solid #c4c7ce;
    }
  }

  .last-list {
    text-align: right;
    font-size: 14px;
    color: #8c8e90;
    padding-bottom: 15px;
    padding-right: 15px;
    cursor: pointer;
  }
}

.int-block {
  width: 654px;
  position: relative;
  margin-top: 16px;
  font-size: 14px;
  font-weight: bold;
}

.demIpu {
  position: absolute;
  background-image: url("../../assets/baidu/nicon.png");
  display: inline-block;
  width: 68px;
  height: 34px;
  background-repeat: no-repeat;
  background-size: 46%;
  background-position: 0px -60px;
  right: 70px;
  top: 3px;
  z-index: 9;
}

:deep(.el-input-group__append) {
  background: #4e6ef2;
  color: #fff;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  height: 44px;
  //border: 2px solid #c4c7ce;
}

:deep(.el-input__wrapper) {
  border-top: 2px solid #c4c7ce;
  border-bottom: 2px solid #c4c7ce;
  border-left: 2px solid #c4c7ce;
  border-radius: 10px 0 0 10px;
}
:deep(.el-input__inner) {
  font-weight: bold;
}

:deep(.is-focus) {
  border-top: 2px solid #409eff;
  //border-bottom: 2px solid #409eff;
  border-left: 2px solid #409eff;
  border-bottom: 0;
  box-shadow: none;
  border-radius: 10px 0 0 0;
}

.error {
  position: absolute;
  right: 152px;
  top: 50%;
  transform: translateY(-50%);
  color: #c6c6c6;
  cursor: pointer;
}

</style>
